<!doctype html>



  


<html class="theme-next pisces use-motion">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/vendors/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/vendors/font-awesome/css/font-awesome.min.css?v=4.4.0" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.0.1" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="王雨峰, 博客" />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.0.1" />






<meta name="description" content="今儿上完课设，老师果然讲的比较少，周四还不用去，看来还是学生自己折腾。我在做课设的过程中，攒了一些心得/体会，希望能和大家分享分享，也希望能一起探讨探讨。如果是我能回答的问题，我很乐意能够提供帮助。
课设这东西是要写出一个大的整体，和咱们上学期写的那些习题不太一样。那些题都是明确给出了具体的目的。而这个课设给出了一系列较为宏观的需求，要咱们自己去设计一些综合的方法，开始时可能觉得迷茫，无从下手，不">
<meta property="og:type" content="article">
<meta property="og:title" content="C语言课设心得分享(一)">
<meta property="og:url" content="http://wangyufeng.org/2015/03/28/c-e8-af-ad-e8-a8-80-e8-af-be-e8-ae-be-e5-bf-83-e5-be-97-e5-88-86-e4-ba-ab-e4-b8-80/index.html">
<meta property="og:site_name" content="王雨峰的博客">
<meta property="og:description" content="今儿上完课设，老师果然讲的比较少，周四还不用去，看来还是学生自己折腾。我在做课设的过程中，攒了一些心得/体会，希望能和大家分享分享，也希望能一起探讨探讨。如果是我能回答的问题，我很乐意能够提供帮助。
课设这东西是要写出一个大的整体，和咱们上学期写的那些习题不太一样。那些题都是明确给出了具体的目的。而这个课设给出了一系列较为宏观的需求，要咱们自己去设计一些综合的方法，开始时可能觉得迷茫，无从下手，不">
<meta property="og:image" content="http://img.blog.csdn.net/20150306163322144?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYXp6d2FjYjkwMDE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center">
<meta property="og:updated_time" content="2015-07-27T08:02:39.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="C语言课设心得分享(一)">
<meta name="twitter:description" content="今儿上完课设，老师果然讲的比较少，周四还不用去，看来还是学生自己折腾。我在做课设的过程中，攒了一些心得/体会，希望能和大家分享分享，也希望能一起探讨探讨。如果是我能回答的问题，我很乐意能够提供帮助。
课设这东西是要写出一个大的整体，和咱们上学期写的那些习题不太一样。那些题都是明确给出了具体的目的。而这个课设给出了一系列较为宏观的需求，要咱们自己去设计一些综合的方法，开始时可能觉得迷茫，无从下手，不">
<meta name="twitter:image" content="http://img.blog.csdn.net/20150306163322144?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYXp6d2FjYjkwMDE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center">



<script type="text/javascript" id="hexo.configuration">
  var NexT = window.NexT || {};
  var CONFIG = {
    scheme: 'Pisces',
    sidebar: {"position":"left","display":"post"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: 0,
      author: '博主'
    }
  };
</script>




  <link rel="canonical" href="http://wangyufeng.org/2015/03/28/c-e8-af-ad-e8-a8-80-e8-af-be-e8-ae-be-e5-bf-83-e5-be-97-e5-88-86-e4-ba-ab-e4-b8-80/"/>

  <title> C语言课设心得分享(一) | 王雨峰的博客 </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  










  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">王雨峰的博客</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">随便写点东西，为互联网贡献一些比特~</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-about">
          <a href="/about" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-user"></i> <br />
            
            关于
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
    </ul>
  

  
</nav>

 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  
  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                C语言课设心得分享(一)
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            <span class="post-meta-item-icon">
              <i class="fa fa-calendar-o"></i>
            </span>
            <span class="post-meta-item-text">发表于</span>
            <time itemprop="dateCreated" datetime="2015-03-28T15:21:41+08:00" content="2015-03-28">
              2015-03-28
            </time>
          </span>

          
            <span class="post-category" >
              &nbsp; | &nbsp;
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="https://schema.org/Thing">
                  <a href="/categories/代码/" itemprop="url" rel="index">
                    <span itemprop="name">代码</span>
                  </a>
                </span>

                
                

              
            </span>
          

          
            
          

          

          
          

          
        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>今儿上完课设，老师果然讲的比较少，周四还不用去，看来还是学生自己折腾。我在做课设的过程中，攒了一些心得/体会，希望能和大家分享分享，也希望能一起探讨探讨。如果是我能回答的问题，我很乐意能够提供帮助。</p>
<p>课设这东西是要写出一个大的整体，和咱们上学期写的那些习题不太一样。那些题都是明确给出了具体的目的。而这个课设给出了一系列较为宏观的需求，要咱们自己去设计一些综合的方法，开始时可能觉得迷茫，无从下手，不知道该干什么。我的感受是在做课设之前，心里要有几个数，或者说对几样东西有谱，这样就能有效地开始着手我们的任务。</p>
<p>1、先构思，后写代码<br>以前我试图写过一个贪吃蛇游戏，没有进行构思和设计，直接开始写代码，想到哪就写到哪，结果开发到中期时，整个程序的结构已经混乱不堪，完全无法维护，不得不放弃了程序。这回我做课设（小球移动）之前，虽然也没做什么规范、详细的设计，但至少按照一些程序设计的方法，简单勾勒了一下程序的框架。<br>比如考虑到面向过程的程序设计，那么我想我有哪些数据（输入，小球等），进而设计数据的设计结构。我选择了用链表+结构体存储小球们的信息，我在后期很多功能的拓展，得益于我为小球选择了较为正确的数据结构，因为我很方便就能添加小球的属性（在咱们将来的面向对象编程中，也就意味着还能很方便地添加小球的功能）。再考虑数据的处理，输出(显示、保存等)。<br>其中对数据的处理自然是核心任务，那我就能由此展开来，考虑模块化的程序设计方法。我将对数据处理的不同任务划分为不同模块(显示球、移动球、响应点击等)，高内聚我做的并不好，因为我经常在一个模块中完成一个以上的任务，最性质恶劣的就是我在delete_ball模块中塞进了许多功能(因为我到最后懒得再新弄一个模块再设计接口了，但现在一想也就是5分钟的事儿)。但是模块之间的低耦合我想我弄的还是不错的，除非是作为枢纽的模块，否则即使删掉某个函数应该对整体也影响不大。具体可以看我文档中的模块关系图。</p>
<blockquote>
<div style="color: #000000; font-size: 14.1176px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12.3529px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-family: Microsoft YaHei;"><br><br><img src="http://img.blog.csdn.net/20150306163322144?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvYXp6d2FjYjkwMDE=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt=""><br><br><br></span></div>

<div style="color: #000000; font-size: 14.1176px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12.3529px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-family: Microsoft YaHei;"><br><br><br></span></div>

<div style="color: #000000; font-size: 14.1176px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12.3529px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-family: Microsoft YaHei;">2、IDE(编程工具)的选择</span></div>

<div style="color: #000000; font-size: 14.1176px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12.3529px; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px;"><span style="font-family: Microsoft YaHei;">(未完持续)</span></div></blockquote>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2015/03/28/e5-b0-86c-e8-af-ad-e8-af-be-e8-ae-be-e4-bc-a0-e5-88-b0-e4-ba-86github-e5-92-8ccode-e4-b8-8a/" rel="next" title="将C语课设传到了Github和Code上">
                <i class="fa fa-chevron-left"></i> 将C语课设传到了Github和Code上
              </a>
            
          </div>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2015/03/28/c-e8-af-ad-e8-af-be-e8-ae-be-e5-bf-83-e5-be-97-e5-88-86-e4-ba-ab-e4-ba-8c/" rel="prev" title="C语课设心得分享(二)">
                C语课设心得分享(二) <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel ">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/avatar.gif"
               alt="Alan" />
          <p class="site-author-name" itemprop="name">Alan</p>
          <p class="site-description motion-element" itemprop="description">Alan Wang's personal blog.</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">57</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              
                <span class="site-state-item-count">9</span>
                <span class="site-state-item-name">分类</span>
              
            </div>
          

          
            <div class="site-state-item site-state-tags">
              
                <span class="site-state-item-count">4</span>
                <span class="site-state-item-name">标签</span>
              
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

      </section>

      
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">
            
              
            
            
              <p class="post-toc-empty">此文章未包含目录</p>
            
          </div>
        </section>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2016</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">Alan</span>
</div>

<div class="powered-by">
  Powered by <a class="theme-link" href="https://hexo.io">Hexo</a> 
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Pisces
  </a>
</div>

        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/vendors/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/vendors/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/vendors/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/vendors/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.0.1"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.0.1"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.0.1"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.0.1"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.0.1"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.0.1"></script>



  



  




  
  

  

  

  

</body>
</html>
